package com.ygp;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * <Description> <br>
 *
 * @author linmiaolai@sanyygp.com<br>
 * @version 1.0<br>
 * @date 2021/09/23 <br>
 */
public class TimeTest {
    public static void main(String[] args) {
        String time = "Sat Oct 09 00:00:00 CST 2021";
//        Date date = new Date(time);
//        Instant instant = date.toInstant();//An instantaneous point on the time-line.(时间线上的一个瞬时点。)
//        ZoneId zoneId = ZoneId.systemDefault();//A time-zone ID, such as {@code Europe/Paris}.(时区)
//        LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
        DateTimeFormatter df = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
        LocalDateTime parse = LocalDateTime.parse(time,df);
        System.out.println(parse);

//        LocalDateTime now = LocalDateTime.now();
//        DateTimeFormatter df = DateTimeFormatter.ofPattern("ddd MMM dd HH:mm:ss CST yyyy");
//        System.out.println(LocalDateTime.parse(time, df));
    }
}
